<template>
    <!-- <div class="menu">
        <el-aside width="200px">
            <el-menu
            default-active="2"
            class="el-menu-vertical-demo"
            background-color="#2578b5"
            text-color="#fff"
            active-text-color="#ffd04b">
            <el-submenu index="1">
              <template slot="title">
                <i class="el-icon-location"></i>
                <span>导航一</span>
              </template>
              <el-menu-item-group>
                <el-menu-item index="1-1">选项1</el-menu-item>
                <el-menu-item index="1-2">选项2</el-menu-item>
              </el-menu-item-group>
              </el-submenu>
          </el-menu>
        </el-aside>
    </div> -->
    <div class="menu">
        <el-aside width="200px">
            <el-menu
            router
            default-active="2"
            class="el-menu-vertical-demo"
            background-color="#2578b5"
            text-color="#fff"
            active-text-color="#ffd04b">
 
            <!-- 在这里遍历,进行绑定 -->
            <template v-for="(item,index) in menus">
                <el-submenu :index="index+''" :key="index" v-if="!item.hidden">
                    <template slot="title">
                      <i class="el-icon-location"></i>
                      <span>{{item.name}}</span>
                    </template>
                    <el-menu-item-group v-for="(child,index) in item.children" :key="index">
                      <el-menu-item :index="child.path">{{child.name}}</el-menu-item>
                    </el-menu-item-group>
                </el-submenu>
            </template>
          </el-menu>
        </el-aside>
    </div>
</template>
<script>
export default{
    name:"menu_",
    data(){
        return{
            menus:[]
        }
    },
    created(){
        console.log(this.$router.options.routes)
        this.menus = [...this.$router.options.routes]
    }
}
</script>
<style scoped>
.el-aside{
    height: 100%;
}
.el-menu{
    height: 100%;
}
.el-submenu-item{
    min-width: 0;
}
</style>